/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Frmretest.java
 *
 * Created on 19/02/2011, 12:33:02 AM
 */
package interfaz1;

import java.awt.Frame;
import java.awt.Menu;
import javax.swing.JOptionPane;

/**
 *
 * @author CLIENTE
 */
public class Frmretest extends javax.swing.JFrame {

    /** Creates new form Frmretest */
    public Frmretest() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        lblcedretest = new javax.swing.JLabel();
        lblnomretest = new javax.swing.JLabel();
        lblapretest = new javax.swing.JLabel();
        txtcedretest = new javax.swing.JTextField();
        txtnomretest = new javax.swing.JTextField();
        txtapretest = new javax.swing.JTextField();
        btnelimest = new javax.swing.JButton();
        btncanretest = new javax.swing.JButton();
        btnsalirretest = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Estudiantes");
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel1.setFont(new java.awt.Font("Bookman Old Style", 1, 12));
        jLabel1.setText("Retirar Estudiante");
        getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 30, 130, 20));

        lblcedretest.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lblcedretest.setText("Cedula:");
        getContentPane().add(lblcedretest, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 80, 50, 20));

        lblnomretest.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lblnomretest.setText("Nombre:");
        getContentPane().add(lblnomretest, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 130, 50, 20));

        lblapretest.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lblapretest.setText("Apellido:");
        getContentPane().add(lblapretest, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 180, 50, 20));

        txtcedretest.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        getContentPane().add(txtcedretest, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 80, 140, -1));

        txtnomretest.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        getContentPane().add(txtnomretest, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 130, 140, -1));

        txtapretest.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        getContentPane().add(txtapretest, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 180, 140, -1));

        btnelimest.setText("Eliminar");
        btnelimest.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnelimestActionPerformed(evt);
            }
        });
        getContentPane().add(btnelimest, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 250, -1, -1));

        btncanretest.setText("Cancelar");
        btncanretest.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btncanretestActionPerformed(evt);
            }
        });
        getContentPane().add(btncanretest, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 250, -1, -1));

        btnsalirretest.setText("Salir");
        btnsalirretest.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnsalirretestActionPerformed(evt);
            }
        });
        getContentPane().add(btnsalirretest, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 250, 70, -1));

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-416)/2, (screenSize.height-336)/2, 416, 336);
    }// </editor-fold>//GEN-END:initComponents

    private void btnsalirretestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnsalirretestActionPerformed
        // TODO add your handling code here:
        dispose();
    }//GEN-LAST:event_btnsalirretestActionPerformed

    private void btncanretestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btncanretestActionPerformed
        // TODO add your handling code here:
        txtapretest.setText("");
        txtcedretest.setText("");
        txtnomretest.setText("");
    }//GEN-LAST:event_btncanretestActionPerformed

    private void btnelimestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnelimestActionPerformed
        // TODO add your handling code here:
        if (!txtcedretest.getText().isEmpty()) {
            Estudiante miestudiante ;
            miestudiante = FrmOperacionesseccion.getMiseccion().BuscarEstudiante(txtcedretest.getText());
            if (miestudiante != null) {
                FrmOperacionesseccion.getMiseccion().RetirarEstudiante(txtcedretest.getText());
                JOptionPane.showMessageDialog(new Frame(), "Estudiante Eliminado", "Aviso", JOptionPane.PLAIN_MESSAGE);
            } else {
                JOptionPane.showMessageDialog(new Frame(), "El Estudiante no Existe", "Aviso", JOptionPane.PLAIN_MESSAGE);
            }
        } else {
            JOptionPane.showMessageDialog(new Frame(), "El campo cedula esta en blanco, verifique", "Aviso", JOptionPane.PLAIN_MESSAGE);
        }



    }//GEN-LAST:event_btnelimestActionPerformed
    /**
     * @param args the command line arguments
     */
    void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Frmretest().setVisible(true);




            }
        });




    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btncanretest;
    private javax.swing.JButton btnelimest;
    private javax.swing.JButton btnsalirretest;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel lblapretest;
    private javax.swing.JLabel lblcedretest;
    private javax.swing.JLabel lblnomretest;
    private javax.swing.JTextField txtapretest;
    private javax.swing.JTextField txtcedretest;
    private javax.swing.JTextField txtnomretest;
    // End of variables declaration//GEN-END:variables
}
